home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-06-22 | 1.3 KB | 60 lines | [TEXT/MPS ] |
- Program Ext_SoundToPict;
-
- Uses MemTypes, QuickDraw, OSIntf,
- ToolIntf, PackIntf, Sound;
-
- Var
- DFile, DSound:str255;
- DPict:PicHandle;
-
- procedure SoundToPict(
- var TheFile, SoundName:str255;
- var MyPict:PicHandle);
-
- type
- FFSynthHandle = ^FFSynthPtr;
-
- var
- MySound:FFSynthHandle;
- TheRes:integer;
- MyPtr:Ptr;
- MyFFPtr:FFSynthPtr;
-
- begin
- MyPict:=Nil;
- TheRes:=OpenResFile(TheFile);
- MySound:=FFSynthHandle(GetNamedResource
- ('Snd ',SoundName)); {Locate SND}
- {Test if the sound was found and read}
- if MySound<>Nil then
- begin
- Hlock(Handle(MySound));
- {Copy the Pointer}
- MyPtr:=Ptr(MySound^);
- {Type coerce the new Ptr}
- MyFFPtr:=FFSynthPtr(MyPtr);
- {Set the playback mode and ratio}
- MyFFPtr^.mode:=FFMode;
- MyFFPtr^.count:=FixRatio(1,1);
- MyFFPtr^.wavebytes[0]:=0;
- {Type coerce the handle to type}
- {PicHandle}
- MyPict:=Pichandle(MySound);
- {Lock the picture so we don't lose it}
- HLock(Handle(MyPict));
- {Coerce and Copy the pointer}
- MyPict^:=PicPtr(MyPtr);
- {Unlock the Handles before leaving}
- HUnlock(Handle(MySound));
- Hunlock(Handle(MyPict));
- {Now Detach the Resource since we}
- {have another handle to it.}
- DetachResource(Handle(MySound));
- end; {if mysound<>Nil}
- CloseResFile(TheRes);
- end; {SoundToPict}
-
- Begin
- SoundToPict(DFile, DSound, DPict);
- End. {Main Block}
-